<template>
  <div class="father">
    <h3>父组件</h3>
    <div class="content">
      <CategorynameSlot title="游戏列表">
        <template v-slot:content>
          <ul class="item">
            <li class="title" v-for="item in games" :key="item.name">
              {{ item.name }}
            </li>
          </ul>
        </template>
        <template #more>更多信息>></template>
      </CategorynameSlot>
      <Category title="美食列表">
        <template v-for="item in foods" :key="item.name">
          <li class="title">
            {{ item.name }}
          </li>
        </template>
      </Category>
      <Category title="影视列表">
        <template v-for="item in movies" :key="item.name">
          <ul>
            <li class="title">
              {{ item.name }}
            </li>
          </ul>
        </template>
      </Category>
    </div>
  </div>
</template>

<script setup lang="ts" name="Father">
import { ref } from "vue";
import Category from "./Category.vue";
import CategorynameSlot from "./CategorynameSlot.vue";

let games = ref([
  { name: "英雄联盟", price: 10 },
  { name: "王者荣耀", price: 20 },
  { name: "穿越火线", price: 30 },
]);
let foods = ref([
  { name: "牛排", price: 10 },
  { name: "牛排", price: 20 },
  { name: "牛排", price: 30 },
]);
let movies = ref<{ name: string; price: number }[]>([]); //ts添加了显式的类型注解
</script>

<style scoped>
.father {
  background-color: rgb(165, 164, 164);
  padding: 20px;
  border-radius: 10px;
}
.content {
  display: flex;
  justify-content: space-evenly;
}
</style>
